<div class="ibox">
    <div class="ibox-content">
        <form method="post" class="form-horizontal" action="${cxt!}/cms/academyArticle/update" id="articleForm" >
        <input type="hidden" id="academyarticleid" name="academyarticle.id" value="${updateArticle.id!}">
            <div class="form-group">
                <div class="col-md-2"></div>
                <div class="col-md-1">
                    <label>${_res["wealth.article.cover"]}:<span class="fontColorRed"> *</span></label>
                </div>
                <div class="col-md-3">
                    <div class="col-md-3 proimgfiles">
                        <a href="javascript:void(0)" class="filesIconAdd" id="uploadproimgfiles">
                            <!-- //ajax片段开始 -->
                            <%  #ajax uploadproimgfiles: {%> 
                                <% if (isEmpty(uploadFile)) { %>
                                    <img src="${imgCxt!}/${updateArticle.url!}" width="100%" height="100%" style="position: relative; z-index: 99999;" >
                                <% } else { %>
                                    <input type="hidden" name="academyarticle.url" value="${uploadFile.path!}" /> 
                                    <img src="${imgCxt!}/${uploadFile.path!}" width="100%" height="100%" style="position: relative; z-index: 99999;">
                                <% } %>
                            <% } %>
                            <!-- //ajax片段结尾 -->
                        </a> 
                        <input type="file" style="opacity: 0" id="fileuploadproimgfiles" name="url" />
                    </div>
                </div>
                <div class="col-md-1">
                    <label>${_res["wealth.article.englishcover"]}:<span class="fontColorRed"> *</span></label>
                </div>
                <!-- 上传英文封面 -->
                <div class="col-md-3">
                    <div class="col-md-3 proimgfiles">
                        <a href="javascript:void(0)" class="filesIconAdd" id="uploadDatumFile">
                            <!-- //ajax片段开始  -->
                            <% #ajax uploadDatumFile: {%> 
                                <% if (isEmpty(uploadFile)) { %>
                                    <img src="${imgCxt!}/${updateArticle.urlen!}" width="100%" height="100%" style="position: relative; z-index: 99999;">
                                <% } else { %>
                                    <input type="hidden" name="academyarticle.urlen" value="${uploadFile.path!}" />
                                    <img src="${imgCxt!}/${uploadFile.path!}" width="100%" height="100%" style="position: relative; z-index: 99999;">
                                <% } %>
                            <% } %>
                            <!-- //ajax片段结尾 -->
                        </a> 
                        <input type="file" style="opacity: 0" id="fileuploadDatumFile" name="urlen" />
                    </div>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            
            <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.articletitle"]}:<span class="fontColorRed"> *</span></label>
                <div class="col-md-3">
                    <input type="text" class="form-control" name="academyarticle.title" value="${updateArticle.title!}" required aria-required="true">
                </div>       
                
                 <label class="col-md-2 control-label">${_res["wealth.college.englishtitle"]}:<span class="fontColorRed"> *</span></label>
                 <div class="col-md-3">
                      <input type="text" class="form-control" name="academyarticle.titleen" value="${updateArticle.titleen!}" required aria-required="true">
                 </div>                      
           </div>
           <div class="hr-line-dashed"></div>
           
            <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.articlesubtitle"]}:<span class="fontColorRed"> *</span></label>
                <div class="col-md-3">
                    <input type="text" class="form-control" name="academyarticle.subtitle" value="${updateArticle.subtitle!}" required aria-required="true">
                </div>       
                
                 <label class="col-md-2 control-label">${_res["wealth.college.englishsubtitle"]}:<span class="fontColorRed"> *</span></label>
                 <div class="col-md-3">
                      <input type="text" class="form-control" name="academyarticle.subtitleen" value="${updateArticle.subtitleen!}" required aria-required="true">
                 </div>                      
           </div>
           <div class="hr-line-dashed"></div>
           
           <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.category"]}:<span class="fontColorRed"> *</span></label>
                <div class="col-md-3">
                    <#dict type="select"  name="academyarticle.category"  value="${updateArticle.category!}" id="category" dictCode="ARTICLE_CLASSIFICATION" />
                </div>       
                
                 <label class="col-md-2 control-label">${_res["wealth.college.subcategory"]}:<span class="fontColorRed"> *</span></label>
                 <div class="col-md-3" id="divId">
                    <% #ajax subcategory: {%>
                        <select name="academyarticle.subcategory" class="form-control help-block m-b-none" >
                            <%if(isEmpty(subcategoryList)){%>
                                <option></option>
                            <%}else{
                                for(subcategory in subcategoryList){%>
                                    <option value="${subcategory.value!}"  ${subcategory.selected! == "selected"?"selected='selected'" :""}>${subcategory.name!}</option>
                             <% }
                            } %>
                        </select>
                    <% } %>
                </div>                      
           </div>
           <div class="hr-line-dashed"></div>
           
           <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.posted"]}:<span class="fontColorRed"> *</span></label>
                <div class="col-md-3">
                    <#dict type="radio"  name="academyarticle.posted"  value="${updateArticle.posted!}" dictCode="ARTICLE_POSTED" />
                </div>       
                
                 <label class="col-md-2 control-label">${_res["wealth.college.hot"]}:<span class="fontColorRed"> *</span></label>
                 <div class="col-md-3">
                      <#dict type="radio"  name="academyarticle.hot"  value="${updateArticle.hot!}" dictCode="COMMON_YN" />
                 </div>                      
           </div>
           <div class="hr-line-dashed"></div>
           
           <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.videourl"]}:<span class="fontColorRed">&nbsp;*</span></label>
                <div class="col-md-3">
                    <input type="text" class="form-control" name="academyarticle.videourl" value="${updateArticle.videourl!}" required aria-required="true">
                </div>	
                 
                <label class="col-md-2 control-label">${_res["wealth.college.videourlen"]}:<span class="fontColorRed">&nbsp;*</span></label>
                <div class="col-md-3">
                    <input type="text" class="form-control" name="academyarticle.videourlen" value="${updateArticle.videourlen!}" required aria-required="true">
                </div>  
           </div>
           
           
           <div class="hr-line-dashed"></div>
           
            <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.content"]}:<span class="fontColorRed"> *</span></label>
                <div class="col-md-8">
	                <script name="academyarticle.content" type="text/plain" id="container" style="width:100%; min-height:350px !important">
                    	${updateArticle.content!}
                	</script>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            
            <div class="form-group">
                <label class="col-md-2 control-label">${_res["wealth.college.englishcontent"]}:<span class="fontColorRed"> *</span></label>
                <div class="col-md-8">
	                <script id="container_english" name="academyarticle.contenten" type="text/plain" style="width:100%; min-height:350px !important">
                    	${updateArticle.contenten!}
                	</script>
                </div>
            </div>
            
            <div class="form-group" style="margin-bottom:55px;">
                <div class="row">
                    <div class="col-md-6">
                        <label class="col-md-12 control-label "> 
                            <% if(hasPrivilegeUrl("getAcademyarticleList")){ %>
                                <button type="button" class="btn btn-warning" onClick="ajaxContent('/cms/academyArticle/list');">${_res["system.return"]}</button>
                            <% } %> 
                            <% if(hasPrivilegeUrl("academyArticleUpdate")){ %>
                                <button type="submit" class="btn btn-primary"> ${_res["system.submit"]} </button> 
                            <% } %>  
                        </label>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<#submit formId="articleForm" divId="content" />
<script>
    $(document).ready(function() {
        var editor = new UE.ui.Editor();  
        editor.render("container");
        
        var editor_english = new UE.ui.Editor();  
        editor_english.render("container_english");
        
        selectCategory(${updateArticle.category!});
        
        $("#category").on('change', function() {
            selectCategory($(this).val());
        });
        
        $("a[id^='upload']").on('click', function() {
            var id = $(this).attr("id");
            $("#file" + id).click();
        });
    
        // 选择文件之后执行上传ajaxFileUpload2(divId,fileElementId,toUrl,uploadType,uploadFiles,callback)
        $("input[id^='fileuploadproimgfiles']").on("change", function() {
            var fileElementId = $(this).attr("id");
            ajaxFileUpload2("uploadproimgfiles",fileElementId,"/realty/academyarticle/update.html#uploadproimgfiles","academyArticle","uploadFile");
        });
        
        // 英文封面修改上传
        $("input[id^='fileuploadDatumFile'").on("change", function() {
            var fileElementId = $(this).attr("id");
            ajaxFileUpload2("uploadDatumFile",fileElementId,"/realty/academyarticle/update.html#uploadDatumFile","academyArticle","uploadFile");
        });
    });    
    
    function selectCategory(category){
        var id = $("#academyarticleid").val();
        var data = {'toUrl' : '/realty/academyarticle/update.html#subcategory', 'category' : category, 'id' : id };
        ajaxDiv('divId', '/cms/academyArticle/getUpdateSubcategory', data);
    };
</script>